#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	string s;
	char a;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		int flag = 0;
		if (!isdigit(s[0])) {
			flag ++;
			if (s[0] == 'a') {
				a = '+';
			} else if (s[0] == 'b') {
				a = '-';
			} else if (s[0] == 'c') {
				a = '*';
			} else if (s[0] == 'd') {
				a = '/';
			}
		}
		int t1 = 0;
		int t2 = 0;
		while (isdigit(s[flag])) {
			t1 = t1 * 10 + s[flag++];
		}
		flag++;
		while (isdigit(s[flag])) {
			t2 = t2 * 10 + s[flag++];
		}
		int ans;
		if (a == '+') {
			ans = t1 + t2;
		} else if (a == '-') {
			ans = t1 - t2;
		} else if (a == '*') {
			ans = t1 * t2;
		} else if (a == '/') {
			ans = (int)t1 / t2;
		}
		cout << t1 << a << t2 << ans << endl;

	}

	return 0;
}